var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("BaseModuleUI"),
    a = e("GlobalParams"),
    i = e("AudioManager"),
    r = e("PureHelper"),
    s = cc._decorator,
    l = s.ccclass,
    c = s.property,
    d = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.attack_clip = null),
                (t.skill_one_clip = null),
                (t.skill_two_clip = null),
                (t.die_clip = null),
                (t.is_attack_clip = !1),
                (t.is_skill_one_clip = !1),
                (t.is_skill_two_clip = !1),
                (t.is_die_clip = !1),
                (t.is_run = !1),
                t
            );
        }
        return (
            __extends(t, e),
            (t.prototype.playAttack = function () {
                var e = this;
                if (!this.is_attack_clip && a.GlobalParams.gameSound.value && this.myDisRound()) {
                    this.is_attack_clip = !0;
                    var t = cc.audioEngine.play(this.attack_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(t, function () {
                        e.is_attack_clip = !1;
                    });
                }
            }),
            (t.prototype.playSkillOne = function () {
                var e = this;
                if (!this.is_skill_one_clip && a.GlobalParams.gameSound.value && this.myDisRound()) {
                    this.is_skill_one_clip = !0;
                    var t = cc.audioEngine.play(this.skill_one_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(t, function () {
                        e.is_skill_one_clip = !1;
                    });
                }
            }),
            (t.prototype.playSkillTow = function () {
                var e = this;
                if (!this.is_skill_two_clip && a.GlobalParams.gameSound.value && this.myDisRound()) {
                    this.is_skill_two_clip = !0;
                    var t = cc.audioEngine.play(this.skill_two_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(t, function () {
                        e.is_skill_two_clip = !1;
                    });
                }
            }),
            (t.prototype.playDie = function () {
                var e = this;
                if (!this.is_die_clip && a.GlobalParams.gameSound.value && this.myDisRound()) {
                    this.is_die_clip = !0;
                    var t = cc.audioEngine.play(this.die_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(t, function () {
                        e.is_die_clip = !1;
                    });
                }
            }),
            (t.prototype.playRun = function () {
                var e = this;
                if (!this.is_run && a.GlobalParams.gameSound.value) {
                    this.is_run = !0;
                    var t = i.default.getInstance().playFx("run");
                    cc.audioEngine.setFinishCallback(t, function () {
                        e.is_run = !1;
                    });
                }
            }),
            (t.prototype.myDisRound = function () {
                var e = !1,
                    t = this.node.parent.getChildByName("role_team_" + a.GlobalParams.MatchMyIndex);
                return (
                    cc.isValid(t, !0) &&
                        Math.abs(r.default.Distance(this.node.getPosition(), t.getPosition())) < 600 &&
                        (e = !0),
                    e
                );
            }),
            __decorate([c(cc.AudioClip)], t.prototype, "attack_clip", void 0),
            __decorate([c(cc.AudioClip)], t.prototype, "skill_one_clip", void 0),
            __decorate([c(cc.AudioClip)], t.prototype, "skill_two_clip", void 0),
            __decorate([c(cc.AudioClip)], t.prototype, "die_clip", void 0),
            __decorate([l], t)
        );
    })(n.default);
o.default = d;
